//
// Created by Administrator on 2021/8/6.
//

#include "FileUtils.h"

#include "fstream"
#include "sstream"
using namespace std;

void FileUtils::LoadFile(const std::string& path, std::string& data)
{
    stringstream ss;
    ifstream ifs;
    ifs.exceptions(ifstream::failbit | ifstream::badbit);
    try
    {
        ifs.open(path);
        ss << ifs.rdbuf();
        ifs.close();
        data = ss.str();
    }
    catch(const ifstream::failure& e)
    {
        ERROR(e.what())
    }
}

void FileUtils::LoadImage(const std::string& path, stbi_uc** data, int* x, int* y, int* channels)
{
    //stbi_set_flip_vertically_on_load(1);
    //*data = stbi_load(path.c_str(), x, y, channels, 0);
}